<?php
declare(strict_types=1);
namespace Field;

class SysCateConst
{
    public const pk='CateID';
    public const index=['CateID'];
	public const fields=['CateID','ParentCateID','AttachID','ShortName','Name','Pinyin','GroupAt','Accesson','Rank','CreateAt','UpdateAt','Status','ModUserIDs','Desc','OrderBy','IsDelete','Tags','ProductID','Nav'];
	public const comment=['CateID'=>'','ParentCateID'=>'上级板块','AttachID'=>'分类图标','ShortName'=>'短标题','Name'=>'板块名称','Pinyin'=>'拼音用来伪静态路径','GroupAt'=>'分组','Accesson'=>'权限开关','Rank'=>'排序','CreateAt'=>'','UpdateAt'=>'','Status'=>'禁用启用','ModUserIDs'=>'版主','Desc'=>'版块简介','OrderBy'=>'默认排序方式','IsDelete'=>'逻辑删除','Tags'=>'Tags开关','ProductID'=>'绑定商品','Nav'=>'导航'];
	/*
    * @Field CateID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const CateID = 'CateID';
    /*
    * @Field ParentCateID
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 上级板块
    */
    public const ParentCateID = 'ParentCateID';
    /*
    * @Field AttachID
    * @Type int(10)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 分类图标
    */
    public const AttachID = 'AttachID';
    /*
    * @Field ShortName
    * @Type varchar(16)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 短标题
    */
    public const ShortName = 'ShortName';
    /*
    * @Field Name
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 板块名称
    */
    public const Name = 'Name';
    /*
    * @Field Pinyin
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key MUL
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 拼音用来伪静态路径
    */
    public const Pinyin = 'Pinyin';
    /*
    * @Field GroupAt
    * @Type varchar(16)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 分组
    */
    public const GroupAt = 'GroupAt';
    /*
    * @Field Accesson
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 权限开关
    */
    public const Accesson = 'Accesson';
    /*
    * @Field Rank
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 排序
    */
    public const Rank = 'Rank';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field UpdateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra on update CURRENT_TIMESTAMP
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const UpdateAt = 'UpdateAt';
    /*
    * @Field Status
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 禁用启用
    */
    public const Status = 'Status';
    /*
    * @Field ModUserIDs
    * @Type varchar(240)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 版主
    */
    public const ModUserIDs = 'ModUserIDs';
    /*
    * @Field Desc
    * @Type varchar(400)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 版块简介
    */
    public const Desc = 'Desc';
    /*
    * @Field OrderBy
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 默认排序方式
    */
    public const OrderBy = 'OrderBy';
    /*
    * @Field IsDelete
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 逻辑删除
    */
    public const IsDelete = 'IsDelete';
    /*
    * @Field Tags
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment Tags开关
    */
    public const Tags = 'Tags';
    /*
    * @Field ProductID
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 绑定商品
    */
    public const ProductID = 'ProductID';
    /*
    * @Field Nav
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 导航
    */
    public const Nav = 'Nav';
}

class SysCateColumns
{
public  int $CateID;
   public  int $ParentCateID=0;
   public  int $AttachID=0;
   public  ?string $ShortName='';
   public  ?string $Name='';
   public  ?string $Pinyin='';
   public  ?string $GroupAt='';
   public  int $Accesson=0;
   public  int $Rank=0;
   public  ?string $CreateAt='';
   public  ?string $UpdateAt='';
   public  int $Status=0;
   public  ?string $ModUserIDs='';
   public  ?string $Desc='';
   public  int $OrderBy=0;
   public  int $IsDelete=0;
   public  int $Tags=0;
   public  int $ProductID=0;
   public  int $Nav=0;
	public function toArray():array
	{
		return [
'CateID'=>$this->CateID,
    'ParentCateID'=>$this->ParentCateID,
    'AttachID'=>$this->AttachID,
    'ShortName'=>$this->ShortName,
    'Name'=>$this->Name,
    'Pinyin'=>$this->Pinyin,
    'GroupAt'=>$this->GroupAt,
    'Accesson'=>$this->Accesson,
    'Rank'=>$this->Rank,
    'CreateAt'=>$this->CreateAt,
    'UpdateAt'=>$this->UpdateAt,
    'Status'=>$this->Status,
    'ModUserIDs'=>$this->ModUserIDs,
    'Desc'=>$this->Desc,
    'OrderBy'=>$this->OrderBy,
    'IsDelete'=>$this->IsDelete,
    'Tags'=>$this->Tags,
    'ProductID'=>$this->ProductID,
    'Nav'=>$this->Nav,        ];
	}
}

class SysCateRow
{
	public SysCateColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'CateID' => $this->data->CateID,
        'ParentCateID' => $this->data->ParentCateID,
        'AttachID' => $this->data->AttachID,
        'ShortName' => $this->data->ShortName,
        'Name' => $this->data->Name,
        'Pinyin' => $this->data->Pinyin,
        'GroupAt' => $this->data->GroupAt,
        'Accesson' => $this->data->Accesson,
        'Rank' => $this->data->Rank,
        'CreateAt' => $this->data->CreateAt,
        'UpdateAt' => $this->data->UpdateAt,
        'Status' => $this->data->Status,
        'ModUserIDs' => $this->data->ModUserIDs,
        'Desc' => $this->data->Desc,
        'OrderBy' => $this->data->OrderBy,
        'IsDelete' => $this->data->IsDelete,
        'Tags' => $this->data->Tags,
        'ProductID' => $this->data->ProductID,
        'Nav' => $this->data->Nav, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new SysCateColumns();
        isset($data['CateID']) && $this->data->CateID = (int)$data['CateID'];
           isset($data['ParentCateID']) && $this->data->ParentCateID = (int)$data['ParentCateID'];
           isset($data['AttachID']) && $this->data->AttachID = (int)$data['AttachID'];
           isset($data['ShortName']) && $this->data->ShortName = (string)$data['ShortName'];
           isset($data['Name']) && $this->data->Name = (string)$data['Name'];
           isset($data['Pinyin']) && $this->data->Pinyin = (string)$data['Pinyin'];
           isset($data['GroupAt']) && $this->data->GroupAt = (string)$data['GroupAt'];
           isset($data['Accesson']) && $this->data->Accesson = (int)$data['Accesson'];
           isset($data['Rank']) && $this->data->Rank = (int)$data['Rank'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['UpdateAt']) && $this->data->UpdateAt = (string)$data['UpdateAt'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
           isset($data['ModUserIDs']) && $this->data->ModUserIDs = (string)$data['ModUserIDs'];
           isset($data['Desc']) && $this->data->Desc = (string)$data['Desc'];
           isset($data['OrderBy']) && $this->data->OrderBy = (int)$data['OrderBy'];
           isset($data['IsDelete']) && $this->data->IsDelete = (int)$data['IsDelete'];
           isset($data['Tags']) && $this->data->Tags = (int)$data['Tags'];
           isset($data['ProductID']) && $this->data->ProductID = (int)$data['ProductID'];
           isset($data['Nav']) && $this->data->Nav = (int)$data['Nav'];
    }
}
?>